<HTML><HEAD><TITLE>get_from_heap(+OldHeap, ?Key, ?Datum, -NewHeap)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(heaps)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>get_from_heap(+OldHeap, ?Key, ?Datum, -NewHeap)</H1>
returns the Key-Datum pair in OldHeap with the smallest Key
<H2>Description</H2>

    returns the Key-Datum pair in OldHeap with the smallest Key, and
    also a New Heap which is the Old Heap with that pair deleted.
    The easy part is picking off the smallest element.  The hard part
    is repairing the heap structure.  repair_heap/4 takes a pair of
    heaps and returns a new heap built from their elements, and the
    position number of the gap in the new tree.  Note that repair_heap
    is *not* tail-recursive.
    

</BODY></HTML>
